package com.strato.mvc.i18n.v1_0_0.enhancer;

import java.util.Locale;
import java.util.Map;

import com.strato.annotation.osgi.v1_0_0.service.OsgiService;
import com.strato.i18n.v1_0_0.LocaleContext;
import com.strato.i18n.v1_0_0.Messages;
import com.strato.mvc.api.v1_0_0.view.ModelEnhancer;

@OsgiService
public class I18nEnhancer implements ModelEnhancer {

	@Override
	public void enhance(Map<Object, Object> model) {
		model.put("i18n", Messages.getInstance());
		Locale locale = LocaleContext.get();
		if(locale==null){
			locale=Locale.getDefault();
		}
		model.put("locale", locale);
	}

	
	public static void main(String[] a){
		Locale locale=Locale.getDefault();
		System.out.println(locale.getCountry());
		System.out.println(locale.getLanguage());
	}
}
